﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ImportExcel.aspx.cs" Inherits="FBKPI.Tools.ImportExcel.ImportExcel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Import</title>
    <script src="../../Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-ui-1.8.23.min.js" type="text/javascript"></script>
    <link href="../../Styles/style.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {
            $("#lnk_download").live("click", function () {
                var importMode = $("#txt_mode").val();
                if (importMode.toString().indexOf("employee") >= 0) {
                    $.ajax({
                        url: '../../Tools/ImportExcel/Handler/DownloadTemplateHandler.ashx?modul=employee',
                        type: "POST",
                        success: function (data) {
                            document.location = data;
                            return false;
                        },
                        error: function (data) {
                            alert("Error while downloading employee template file, please contact IT support");
                            return false;
                        }
                    });
                    return false;
                }
                else if (importMode.toString().indexOf("kpi") >= 0) {
                    $.ajax({
                        url: '../../Tools/ImportExcel/Handler/DownloadTemplateHandler.ashx?modul=kpi',
                        type: "POST",
                        success: function (data) {
                            document.location = data;
                            return false;
                        },
                        error: function (data) {
                            alert("Error while downloading kpi template file, please contact IT support");
                            return false;
                        }
                    });
                    return false;
                }
            });
        })
    </script>
    <style type="text/css">
        .modal
        {
            position: fixed;
            top: 0;
            left: 0;
            background-color: White;
            z-index: 99;
            opacity: 0.8;
            filter: alpha(opacity=80);
            -moz-opacity: 0.8;
            min-height: 100%;
            width: 100%;
        }
        .loading
        {
            font-family: Arial;
            font-size: 10pt;
            /*border: 5px solid #67CFF5;*/
            width: 300px;
            height: 200px;
            display: none;
            position: fixed;
            background-color: White;
            z-index: 999;
        }
    </style>
    <script type="text/javascript">
        function ShowProgress() {
            setTimeout(function () {
                var modal = $('<div />');
                modal.addClass("modal");
                $('body').append(modal);
                var loading = $(".loading");
                loading.show();
                var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
                var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
                loading.css({ top: top, left: left });
            }, 200);
        }
        $('form').live("submit", function () {
            ShowProgress();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="importexcelformarea" class="ui-widget-content padding5px ui-corner-all">
        <table class="dialogTable">
            <tr>
                <td width="100px">
                    Select File
                </td>
                <td>
                    :
                </td>
                <td>
                    <asp:FileUpload ID="upload" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    Result
                </td>
                <td>
                    :
                </td>
                <td>
                    <asp:Label ID="lbl_result" Font-Bold="false" ForeColor="Red" runat="server"></asp:Label><input
                        type="hidden" id="uploadpath" runat="server" /><input type="hidden" runat="server"
                            id="txt_mode">
                </td>
            </tr>
        </table>
        <br />
    </div>
    <br />
    <div>
        <asp:Button runat="server" ID="btn_upl" Text="Upload" OnClick="btn_upl_Click" />&nbsp;<asp:Button
            runat="server" ID="btn_import" Text="Import" OnClick="btn_import_Click" />&nbsp;<a
                href="#" id="lnk_download">download template</a> 
    </div>
    <div class="loading" align="center">
        Loading. Please wait.<br />
        <br />
        <img src="../../images/process_load.gif"/>
    </div>
    </form>
</body>
</html>
